import React from 'react';
import {Link} from 'react-router';
import Header from './js/components/header';

import FilmStore from './js/filmStore';
import {Actions} from './js/filmStore/actions';

function get_film(id){
    return FilmStore.getFilm(id)
}
export default class FilmDetail extends React.Component {
    constructor(props){
        super(props);
        this.state = {
            mainNav : false,
            film : get_film(this.props.params.id.replace(':',''))
        };
    }

    componentWillMount(){
    }
    componentDidMount(){
        Actions.ctrlNav({show:false,active:0});
    }
    componentDidUpdate(){

    }
    renderReport(){
        let _report = this.state.film;
        console.log('detail',_report);
        let _d_0 = (
                <div key="r_0" className="label-list">
                    <h2>检查信息</h2>
                    <ul>
                        <li><label>姓名</label>{_report.user.name}</li>
                        <li><label>性别</label>{_report.user.sex==1?'男':'女'}</li>
                        <li><label>年龄</label>{_report.user.age}岁</li>
                        <li><label>检查医院</label>{_report.hospital}</li>
                        <li><label>检查日期</label>{_report.report.writeDate}</li>
                        <li><label>检查部位</label>{_report.part}</li>
                    </ul>
                </div>
                );
        let _d_1 = (
                <div key="r_1" className="label-list">
                    <h2>报告信息</h2>
                    <ul>
                        <li><label>检查所见</label>{_report.report.content}</li>
                        <li><label>诊断建议</label>{_report.report.suggest}</li>
                        <li><label>报告医生</label>{_report.report.writer}</li>
                        <li><label>审核医生</label>{_report.report.checker}</li>
                        <li><label>报告日期</label>{_report.report.writeDate}</li>
                    </ul>
                </div>
                );
        const _d_2 = (
            <div className="bottom-bar" key="r_2">
                <Link to={"/films/order/"+this.props.params.id} className="btn btn-blue">打印影像</Link>
            </div>
        );
        return [_d_0,_d_1,_d_2]
    }
    render(){
        return (
            <div style={{paddingBottom:'66px'}}>
                <Header title="影像报告">
                    <Link to='/' className='l1'>返回</Link>
                     {  /* <Link to={browserHistory} className='r1'>查看</Link>
                    <Link to={browserHistory} className='r2'>分享</Link>*/}
                </Header>
                {this.renderReport()}
            </div>
        )
    }
}